package net.livingflow.model;

import java.io.Serializable;
import java.util.Date;
import java.util.HashSet;
import java.util.Set;

import javax.jdo.annotations.IdentityType;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;
import javax.jdo.annotations.PrimaryKey;

/**
 * @author xueqiang.mi
 * @since 2010-12-18
 */
@PersistenceCapable(identityType = IdentityType.APPLICATION)
public class Account implements Serializable {
	private static final long serialVersionUID = 2417567812870751573L;
	@PrimaryKey
	private String name;
	@Persistent
	private String type;
	@Persistent
	private Date crtDate;
	@Persistent
	private Date modDate;
	@Persistent
	private Set<String> friends;

	public Date getCrtDate() {
		return crtDate;
	}

	public Set<String> getFriends() {
		if (friends == null) {
			friends = new HashSet<String>();
		}
		return friends;
	}

	public Date getModDate() {
		return modDate;
	}

	public String getName() {
		return name;
	}

	public String getType() {
		return type;
	}

	public void setCrtDate(Date crtDate) {
		this.crtDate = crtDate;
	}

	public void setFriends(Set<String> friends) {
		this.friends = friends;
	}

	public void setModDate(Date modDate) {
		this.modDate = modDate;
	}

	public void setName(String name) {
		this.name = name;
	}

	public void setType(String type) {
		this.type = type;
	}

	@Override
	public String toString() {
		return "Account [crtDate=" + crtDate + ", friends=" + friends + ", modDate=" + modDate + ", name=" + name
				+ ", type=" + type + "]";
	}
}
